﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace helloworld2.MODEL
{
    class StationContainer
    {
        private static StationContainer instance=null;

        private StationContainer()
        {
        }

        public static StationContainer Instance
        {
            get
            {
                if (instance==null)
                {
                    instance = new StationContainer();
                }
                return instance;
            }
        }

        List<Station> stations = new List<Station>();

        public void addStation(Station newStation)
        {
            stations.Add(newStation);
        }

        public Station getStationByCoordinates(KeyValuePair<int, int> coordinates)
        {
            Station s = new Station();
            for (int i = 0; i < stations.Count; i++)
            {
                s = stations[i];
                if (s.lookForCoordinates(coordinates))
                {
                    i = stations.Count;
                }
            }
            return s;
        }

    }
}
